﻿Imports Oracle.DataAccess.Client
Public Class cError
    Public Shared Sub SalvaError(ByVal ex As Exception, ByVal Revisa As String)
        Using conn As OracleConnection = New OracleConnection(My.Settings.ConnectionString)
            Using cmd As OracleCommand = conn.CreateCommand
                cmd.CommandText = "INSERT INTO GLO_ERROR (FECHA,MENSAJE,NUMEROERROR,CLASE,SUBCLASE,REVISA,ESTADO) VALUES(SYSDATE,:PMENSAJE,:PNUMEROERROR,:PCLASE,:PSUBCLASE,:PREVISA,'N')"
                cmd.Parameters.Add("PMENSAJE", OracleDbType.Varchar2).Value = ex.Message
                cmd.Parameters.Add("PNUMEROERROR", OracleDbType.Int32).Value = ex.GetHashCode
                cmd.Parameters.Add("PCLASE", OracleDbType.Varchar2).Value = ex.TargetSite.DeclaringType.FullName
                cmd.Parameters.Add("PSUBCLASE", OracleDbType.Varchar2).Value = ex.TargetSite.Name
                cmd.Parameters.Add("PREVISA", OracleDbType.Varchar2).Value = Revisa
                conn.Open()
                cmd.ExecuteNonQuery()
                conn.Close()
            End Using
        End Using
    End Sub

End Class
